﻿<!DOCTYPE html>
<html>
<head>
    <!--<base href="../" />-->
    <meta charset="UTF-8">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="/static/css/angularStyle.css" />
    <link rel="stylesheet" href="/static/css/common/reset.css" />
    <link rel="stylesheet" href="/static/css/associate.css" />
    <link rel="stylesheet" href="/static/css/sweetalert.min.css" />
    <link rel="stylesheet" href="/static/js/simditor/styles/simditor.css" />
    <link rel="stylesheet" href="/static/js/simditor/styles/simditor-html.css" />
    <title>宾果高校</title>
    <style>
        .c-c-l input[type='radio'] {
            width: 20px;
            height: 20px;
            visibility: hidden;
        }

            .c-c-l input[type='radio']:checked + label:after {
                content: '';
                width: 10px;
                height: 5px;
                position: absolute;
                top: 4px;
                left: 3px;
                border-bottom: 3px solid #4c4c4c;
                border-left: 3px solid #4c4c4c;
                transform: rotate(-45deg);
                -ms-transform: rotate(-45deg);
                -webkit-transform: rotate(-45deg);
            }

        .c-c-l label {
            position: absolute;
            left: 0;
            top: 0;
            width: 20px;
            height: 20px;
            border: 1px solid #d4d4d4;
            -webkit-border-radius: 1px;
            -moz-border-radius: 1px;
            border-radius: 1px;
            background: #fff;
        }

        /*.contract-progress-bar.proTips div {
            position: relative;
            float: left;
            width: 20%;
            min-height: 20px;
            text-align: center;
        }*/

        .div-show {
            position: relative;
            float: left;
            width: 20%;
            min-height: 20px;
            text-align: center;
        }

        .contract-progress-bar.proTips div a {
            color: #F2524A;
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <div class="contractDetail" ng-app="myApp">
        <div id="divHeader"></div>
        <div ng-cloak ng-controller="contractDetailsCtrl">
            <div ng-model="names">
                <section class="main pt10">
                    <ul class="support-ul pt10 clearfix">
                        <li>首页</li>
                        <li>社团</li>
                        <li>赞助筹备</li>
                        <li>我的合同</li>
                        <li>详情查看</li>
                    </ul>
                </section>
                <section class="main">
                    <div class="support-activity">
                        <h1 class="f20 textcenter">{{names.ProjectName}}</h1>
                        <h2 class="textcenter mt10">{{names.CreateDate}}</h2>
                    </div>
                </section>
                <section class="main">
                    <!--<h2 class="f16 mb10">合作状态:
                        <select>
                            <option>未确定</option>
                            <option>已同意</option>
                            <option>已拒绝</option>
                            <option>已过期</option>
                        </select>
                    </h2>-->
                    <ul class="support-list">
                        <li class="clearfix">
                            <div class="w100 fl">
                                <div class="w100 f16 clearfix">
                                    <p class="fl" ng-if="names.UserType == 'Student' || names.UserType == 'Company'">{{names.UserType == 'Student' ? '赞助企业' : '赞助社团'}}：{{ names.CreateBySelf == 'Y' ? names.Name : names.CreatorName}}</p>
                                    <p class="fl ml10">合同编号：{{names.ContractCode}}</p>
                                    <p class="fr f14 colorLGray">{{names.ContractDate}}</p>
                                </div>
                                <p class="mt10 f14" ng-if="names.UserType == 'Student' || names.UserType == 'Company'">
                                    <span>{{names.UserType == 'Student' ? '企业联系人' : '社团联系人'}}：{{names.CreateBySelf == 'Y' ? names.ContractorName : names.Creator}} </span>
                                    <span class="ml20">联系电话：{{names.CreateBySelf == 'Y' ? names.ContractorPhone : names.CreatorPhone}}</span>
                                    <span class="ml20">QQ：{{names.CreateBySelf == 'Y' ? names.ContractorQQ : names.CreatorQQ}}</span>
                                </p>
                                <div class="contract-progress">
                                    <div class="contract-progress-bar f20 clearfix">
                                        <div id="divStudent" ng-if="names.UserType == 'Student' || names.UserType == 'Company'">
                                            <p>确定合同</p>
                                            <p>企业付款</p>
                                            <p>社团首款</p>
                                            <p>活动反馈</p>
                                            <p>社团尾款</p>
                                        </div>
                                        <div id="divAgent" ng-if="names.UserType == 'Agent'">
                                            <p class="colorRed">确定合同</p>
                                            <p>企业付款</p>
                                            <p>代理官奖金<a href="javascript:void(0)" class="colorRed">（冻结）</a></p>
                                            <p>社团活动反馈</p>
                                            <p>代理官奖金<a href="javascript:void(0)" class="colorRed">（到账）</a></p>
                                        </div>
                                    </div>
                                    <div class="contract-progress-bar proBanner">
                                        <h1 class="contract-pbar-bg"></h1>
                                        <!--done是打钩状态，doing是数字状态，bar是长度条-->
                                        <p class="done"><span>1</span><label class="hide">1</label></p>
                                        <p class=""><span>2</span><label class="hide">2</label></p>
                                        <p class=""><span>3</span><label class="hide">3</label></p>
                                        <p><span>4</span><label class="hide">4</label></p>
                                        <p><span>5</span><label class="hide">5</label></p>
                                    </div>
                                    <div class="contract-progress-bar f16 clearfix">
                                        <p>{{names.ContractStep1Date}}</p>
                                        <p>&nbsp;{{names.ContractStep2Date}}</p>
                                        <p>&nbsp;{{names.ContractStep3Date}}</p>
                                        <p>{{names.ContractStep4Date}}</p>
                                        <p>&nbsp;{{names.ContractStep5Date}}</p>
                                    </div>
                                    <div class="contract-progress-bar proTips f16 mt10 clearfix">
                                        <div class="div-show">
                                            <div class="{{names.Status == 'Effective' && (names.SubStatus=='FeedbackSubmitted' || names.SubStatus=='FeedbackRejected' || names.SubStatus=='FeedbackApproved') ? 'show' : 'hide' }}">
                                                合同已确定
                                            </div>
                                            <div class="{{ (names.UserType == 'Student' || names.UserType == 'Company') && names.Status == 'Effective' && (names.SubStatus=='Pending' || names.SubStatus=='SponMoneyChanged') ? 'show' : 'hide' }}">
                                                <a href="javascript:void(0)" tag="{{names.UserType}}" onclick="CancelRemark('Cancel', this)" class="contract-cancel">取消合同</a>
                                            </div>
                                            <div class="{{names.Status == 'Cancelled' && names.SubStatus=='CompanyCancelled' ? 'show' : 'hide' }}">
                                                企业终止合同<a href="javascript:void(0)" onclick="CancelRemark('Company', this)" class="disblock">合同终止说明</a>
                                            </div>
                                            <div class="{{names.Status == 'Cancelled' && names.SubStatus=='StudentCancelled' ? 'show' : 'hide' }}">
                                                社团终止合同<a href="javascript:void(0)" onclick="CancelRemark('Student', this)" class="disblock">合同终止说明</a>
                                            </div>
                                        </div>
                                        <div class="div-show">
                                            &nbsp;
                                            <!--<div class="{{names.UserType == 'Company' && names.Status == 'Effective' && names.SubStatus=='Pending' ? 'show' : 'hide' }}">
                                                <a href="javascript:void(0)">进行付款</a>
                                            </div>-->
                                        </div>
                                        <div class="div-show">&nbsp;</div>
                                        <div class="div-show">
                                            <div class="{{names.UserType == 'Student' && names.Status == 'Effective' && (names.SubStatus=='Pending' || names.SubStatus=='SponMoneyChanged') ? 'show' : 'hide' }}">
                                                <a href="javascript:void(0)" onclick="Feedback('Submit')" class="contract-pBar-feedback">请提交活动反馈</a>
                                            </div>
                                            <div class="{{(names.UserType == 'Company' || names.UserType == 'Agent') && names.Status == 'Effective' && names.SubStatus=='Pending' ? 'show' : 'hide' }}">
                                                社团反馈未提交，请等待
                                            </div>
                                            <div class="{{names.UserType == 'Company' && names.Status == 'Effective' && names.SubStatus=='FeedbackSubmitted' ? 'show' : 'hide' }}">
                                                <a href="javascript:void(0)" onclick="Feedback('Check')" class="contract-pBar-feedback">社团反馈已提交，请验收</a>
                                            </div>
                                            <div class="{{(names.UserType == 'Company' || names.UserType == 'Agent') && names.Status == 'Effective' && names.SubStatus=='FeedbackRejected' ? 'show' : 'hide' }}">
                                                验收不通过，<a href="javascript:void(0)" onclick="Feedback('ReView')" class="contract-pBar-feedback">请等待再次提交</a>或联系宾果客服。
                                            </div>
                                            <div class="{{names.Status == 'Effective' && names.SubStatus=='FeedbackApproved' ? 'show' : 'hide' }}">
                                                验收已通过，<a href="javascript:void(0)" onclick="Feedback('View')" class="contract-pBar-feedback">查看社团反馈</a>
                                            </div>
                                            <div class="{{(names.UserType == 'Student' || names.UserType == 'Agent') && names.Status == 'Effective' && names.SubStatus=='FeedbackSubmitted' ? 'show' : 'hide' }}">
                                                <a href="javascript:void(0)" onclick="Feedback('View')" class="contract-pBar-feedback">已提交活动反馈，待验收</a>
                                            </div>
                                            <div class="{{names.UserType == 'Student' && names.Status == 'Effective' && names.SubStatus=='FeedbackRejected' ? 'show' : 'hide' }}">
                                                企业不满意，<a href="javascript:void(0)" class="contract-pBar-feedback" onclick="Feedback('ReSubmit')">请再次提交</a>或联系宾果客服。
                                            </div>
                                        </div>
                                        <div class="div-show">&nbsp;</div>
                                    </div>
                                </div>
                                <div class="contract-detailBtn clearfix">
                                    <div id="divDetails" ng-if="names.UserType == 'Agent'">
                                        <div class="contract-det-text borderR fl pr10">
                                            <p class="mr10"><span>赞助企业：{{names.Name}}</span><span>联系电话：{{names.ContractorPhone}}</span></p>
                                            <p><span>企业联系人：{{names.ContractorName}}</span><span>QQ：{{names.ContractorQQ}}</span></p>
                                        </div>
                                        <div class="contract-det-text fl pl10">
                                            <p class="mr10"><span>邀请社团：{{names.CreatorName}}</span><span>联系电话：{{names.CreatorPhone}}</span></p>
                                            <p><span>社团联系人：{{names.Creator}}</span><span>QQ：{{names.CreatorQQ}}</span></p>
                                        </div>
                                    </div>
                                    <a href="javascript:void(0);" tag="{{names.TemplateVersion}}" onclick="ViewContract(this)">合同详情</a>
                                </div>
                            </div>
                        </li>
                    </ul>
                </section>
            </div>
        </div>
        <div id="divFooter"></div>
    </div>
    <!--遮罩层-->
    <div class="mask hide"></div>
    <!--提交反馈意见-->
    <div class="popBox contractBox hide" id="contractBox">
        <h1 class="contractBox-title">活动反馈<a href="javascript:void(0)" class="contractBox-title-close"></a></h1>
        <div class="contractBox-content">
            <p class="contractBox-content-url">
                <label>照片存储网址：</label>
                <input type="text" id="PhotosUrl" placeholder="请存储于百度网盘，再分享链接至此" />
            </p>
            <p class="contractBox-content-url">
                <label>视频存储网址：</label>
                <input type="text" id="VideoUrl" placeholder="请存储于百度网盘，再分享链接至此" />
            </p>
            <p class="contractBox-content-url">
                <label>推文存储网址：</label>
                <input type="text" id="TweetsUrl" placeholder="请存储于百度网盘，再分享链接至此" />
            </p>
            <div class="title mb10">
                <h3>请填写活动总结</h3>
            </div>
            <textarea id="ActivitySummary" placeholder="请输入活动总结"></textarea>
            <div id="divSatisfy" class="clearfix">
                <a href="javascript:void(0)" class="up-hb-submit confirm" onclick="SubmitUnlick('like')">满意</a>
                <a href="javascript:void(0)" class="up-hb-submit cancel" onclick="Unsatisfy('Submit')" id="unsatisfy">不满意</a>
            </div>
            <div class="clearfix">
                <a href="javascript:void(0)" id="btnViewUnsatisfy" onclick="Unsatisfy('View')" class="up-hb-submit confirm" style="width:160px">企业不满意原因</a>
                <a href="javascript:void(0)" id="btnSubmitFeedback" onclick="SubmitFeedback()" class="up-hb-submit">确认提交</a>
            </div>
        </div>
    </div>
    <div id="contractDetails"></div>
    <!--取消合同-->
    <div class="popBox contractBox hide" id="contractBox-cancel">
        <h1 class="contractBox-title">取消合同<a href="javascript:void(0)" class="contractBox-title-close"></a></h1>
        <div class="contractBox-content">
            <div class="title mb10">
                <h3>请选择取消原因</h3>
            </div>
            <ul class="contractBox-cancel clearfix" id="ulCancelRemark">
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="cancelStudent" value="时间太赶" id="cs1">
                        <label for="cs1"></label>
                    </p>
                    <span class="veraT f14 ml10">时间太赶</span>
                </li>
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="cancelStudent" value="社团准备不足" id="cs2">
                        <label for="cs2"></label>
                    </p>
                    <span class="veraT f14 ml10">社团准备不足</span>
                </li>
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="cancelStudent" value="场地未能申请成功" id="cs3">
                        <label for="cs3"></label>
                    </p>
                    <span class="veraT f14 ml10">场地未能申请成功</span>
                </li>
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="cancelStudent" value="领导审批未通过" id="cs4">
                        <label for="cs4"></label>
                    </p>
                    <span class="veraT f14 ml10">领导审批未通过</span>
                </li>
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="cancelStudent" value="商家付款不及时" id="cs5">
                        <label for="cs5"></label>
                    </p>
                    <span class="veraT f14 ml10">商家付款不及时</span>
                </li>
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="cancelStudent" value="其他" id="cs6">
                        <label for="cs6"></label>
                    </p>
                    <span class="veraT f14 ml10">其他</span>
                    <input type="text" class="veraT" id="txtStudentOther" />
                </li>
            </ul>
            <ul id="ulCompanyCancelRemark" class="contractBox-cancel clearfix">
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="cancelCompany" value="场地有变" id="cc1">
                        <label for="cc1"></label>
                    </p>
                    <span class="veraT f14 ml10">场地有变</span>
                </li>
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="cancelCompany" value="时间无法协调" id="cc2">
                        <label for="cc2"></label>
                    </p>
                    <span class="veraT f14 ml10">时间无法协调</span>
                </li>
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="cancelCompany" value="合同要求无法满足" id="cc3">
                        <label for="cc3"></label>
                    </p>
                    <span class="veraT f14 ml10">合同要求无法满足</span>
                </li>
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="cancelCompany" value="企业自身问题" id="cc4">
                        <label for="cc4"></label>
                    </p>
                    <span class="veraT f14 ml10">企业自身问题</span>
                </li>
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="cancelCompany" value="其他" id="cc5">
                        <label for="cc5"></label>
                    </p>
                    <span class="veraT f14 ml10">其他</span>
                    <input type="text" class="veraT" id="txtCompanyOther" />
                </li>
            </ul>
            <a href="javascript:void(0)" onclick="Cancel()" id="btnCancel" class="up-hb-submit">确认取消</a>
        </div>
    </div>
    <!--不满意-->
    <div class="popBox contractBox hide" id="contractUnlike">
        <h1 class="contractBox-title">不满意原因<a href="javascript:void(0)" class="contractBox-title-close"></a></h1>
        <div class="contractBox-content">
            <div class="title mb10">
                <h3 id="h3UnReason">请选择不满意的原因</h3>
            </div>
            <ul class="contractBox-cancel clearfix">
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="feedbackUnsatisfactory" value="照片不达标" id="fu1">
                        <label for="fu1"></label>
                    </p>
                    <span class="veraT f14 ml10">照片不达标</span>
                </li>
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="feedbackUnsatisfactory" value="视频不达标" id="fu2">
                        <label for="fu2"></label>
                    </p>
                    <span class="veraT f14 ml10">视频不达标</span>
                </li>
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="feedbackUnsatisfactory" value="推文不达标" id="fu3">
                        <label for="fu3"></label>
                    </p>
                    <span class="veraT f14 ml10">推文不达标</span>
                </li>
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="feedbackUnsatisfactory" value="现场效果不满意" id="fu4">
                        <label for="fu4"></label>
                    </p>
                    <span class="veraT f14 ml10">现场效果不满意</span>
                </li>
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="feedbackUnsatisfactory" value="活动参与人数不足" id="fu5">
                        <label for="fu5"></label>
                    </p>
                    <span class="veraT f14 ml10">活动参与人数不足</span>
                </li>
                <li>
                    <p class="c-c-l clearfix">
                        <input type="radio" name="feedbackUnsatisfactory" value="其他" id="fu6">
                        <label for="fu6"></label>
                    </p>
                    <span class="veraT f14 ml10">其他</span>
                    <input type="text" class="veraT" id="txtUnlikeOthers" />
                </li>
            </ul>
            <div class="clearfix">
                <a href="javascript:void(0)" class="up-hb-submit confirm" id="btnUnlick" onclick="SubmitUnlick('unlike')">提交</a>
                <a href="javascript:void(0)" class="up-hb-submit cancel" id="contractUnlikeCancel">取消</a>
            </div>
        </div>
    </div>

    <script type="text/javascript" src="/static/js/ref/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="/static/js/self/common.js"></script>
    <script type="text/javascript" src="/static/js/ref/angular.min.js"></script>
    <script type="text/javascript" src="/static/js/ref/sweetalert.min.js"></script>
    <!--文字编辑器 -->
    <script type="text/javascript" src="/static/js/simditor/scripts/module.min.js"></script>
    <script type="text/javascript" src="/static/js/simditor/scripts/hotkeys.min.js"></script>
    <script type="text/javascript" src="/static/js/simditor/scripts/uploader.min.js"></script>
    <script type="text/javascript" src="/static/js/simditor/scripts/simditor.min.js"></script>
    <script type="text/javascript" src="/static/js/simditor/scripts/beautify-html.js"></script>
    <script type="text/javascript" src="/static/js/simditor/scripts/simditor-html.js"></script>
    <script>

        var param = common.getUrlArgStr();
        if (!common.checkValue(param.id))
            window.location = "contract.html";

        var userType = common.GetUserType();
        if (!common.checkValue(userType))
            window.location = "/login.html";

        $("#divHeader").load("/wuc/header.html");
        $("#divFooter").load("/wuc/footer.html");

        var feedbackType = "Submit";
        var cancelType = "";

        common.CreateController({ name: 'contractDetailsCtrl', url: '/api/project/GetContract?id=' + param.id, objType: 'dict' });

        function AfterCompleted(ctx) {
            if (ctx == null) {
                common.alertMessage("无数据.");
                return;
            }

            window.location = "contract.html";
        }

        function Cancel() {

            var values = {};
            values.ContractID = param.id;
            values.Status = "Cancelled";

            var remark = cancelType == "Student" ? "ulCancelRemark" : "ulCompanyCancelRemark";
            var other = cancelType == "Student" ? "txtStudentOther" : "txtCompanyOther";
            values.SubStatus = cancelType == "Student" ? "StudentCancelled" : "CompanyCancelled";

            $("#" + remark + " [type='radio']").each(function () {

                if ($(this).attr("checked") || $(this).prop("checked")) {
                    var remark = $(this).val();

                    if (remark == "其他")
                        remark += "$%#" + $("#" + other + "").val();

                    values.CancelRemark = remark;
                }
            });

            common.commonAjax({ type: 'Post', url: '/api/project/CancelContract', data: values, sMethod: AfterCompleted, alert: true });
        }

        function SubmitFeedback() {

            var values = common.GetCtrlValues({
                ContentID: "contractBox"
            })

            values.ContractID = param.id;
            values.ActivitySummary = editor.getValue();
            values.Type = feedbackType;

            common.commonAjax({ type: 'Post', url: '/api/project/SubmitFeedback', data: values, sMethod: AfterCompleted, alert: true });
        }

        function SubmitUnlick(type) {
            var values = {};
            values.ContractID = param.id;

            if (type == "unlike") {
                values.Status = "FeedbackRejected";

                $("#contractUnlike [type='radio']").each(function () {

                    if ($(this).attr("checked") || $(this).prop("checked")) {
                        var remark = $(this).val();

                        if (remark == "其他")
                            remark += "$%#" + $("#txtUnlikeOthers").val();

                        values.Remark = remark;
                    }

                });
            }
            else
                values.Status = "FeedbackApproved";


            common.commonAjax({ type: 'Post', url: '/api/project/UpdateContractSubStatus', data: values, sMethod: AfterCompleted, alert: true });
        }

        function ViewFeedback(readOnly) {

            common.commonAjax({ type: 'Get', url: '/api/project/GetContractFeedback?id=' + param.id, sMethod: AfterGetFeedback });

            if (readOnly) {
                $("#contractBox input[type='text']").each(function () {
                    $(this).attr("readonly", "readonly");
                })

                editor.body.attr("contenteditable", false);

            }
        }

        function AfterGetFeedback(ctx) {
            if (ctx == null) {
                common.alertMessage("无数据.");
                return;
            }

            $("#PhotosUrl").val(ctx.ResponseDict.PhotosUrl);
            $("#TweetsUrl").val(ctx.ResponseDict.TweetsUrl);
            $("#VideoUrl").val(ctx.ResponseDict.VideoUrl);
            editor.setValue(ctx.ResponseDict.ActivitySummary);
        }

        function Feedback(type) {
            switch (type) {
                case "View":
                    $("#divSatisfy").hide();
                    $("#btnSubmitFeedback").hide();
                    $("#btnViewUnsatisfy").hide();
                    ViewFeedback(true);
                    break;
                case "ReView":
                    $("#divSatisfy").hide();
                    $("#btnSubmitFeedback").hide();
                    $("#btnViewUnsatisfy").removeClass("confirm");
                    ViewFeedback(true);
                    break;
                case "Submit":
                    $("#divSatisfy").hide();
                    $("#btnViewUnsatisfy").hide();
                    break;
                case "ReSubmit":
                    $("#divSatisfy").hide();
                    $("#btnSubmitFeedback").addClass("cancel");
                    feedbackType = "ReSubmit";
                    ViewFeedback(false);
                    break;
                case "Check":
                    $("#btnSubmitFeedback").hide();
                    $("#btnViewUnsatisfy").hide();
                    ViewFeedback(true);
                    break;
            }
        }

        function ViewContract(obj) {
            var tmpl = $(obj).attr("tag");

            if (!common.checkValue(tmpl)) {
                $(".mask").hide();
                common.alertMessage("此赞助未生成合同信息。");
                return;
            }

            $("#contractDetails").load("/wuc/contractTemplate/" + tmpl + ".html", function () {
                Init(param.id);
            });
        }

        function CancelRemark(type, obj) {

            switch (type) {
                case "Cancel":
                    cancelType = $(obj).attr("tag");
                    break;
                case "Student":
                case "Company":
                    cancelType = type;
                    var remark = type == "Student" ? "ulCancelRemark" : "ulCompanyCancelRemark";
                    var other = type == "Student" ? "txtStudentOther" : "txtCompanyOther";

                    $("#" + remark + " input[type='radio']").each(function () {
                        $(this).attr("disabled", "disabled");
                    })

                    $("#" + other + "").attr("readonly", "readonly");
                    $("#btnCancel").hide();

                    common.commonAjax({ type: 'Get', url: '/api/project/GetContractData?id=' + param.id + "&name=CancelRemark", sMethod: AfterGetCancelRemark });

                    break;
            }

            if (cancelType == "Company")
                $("#ulCancelRemark").hide();
            else
                $("#ulCompanyCancelRemark").hide();
        }

        function AfterGetCancelRemark(ctx) {

            var remark = cancelType == "Student" ? "ulCancelRemark" : "ulCompanyCancelRemark";
            var other = cancelType == "Student" ? "txtStudentOther" : "txtCompanyOther";

            $("#" + remark + " input[type='radio']").each(function () {
                var obj = $(this);

                var name = ctx.ResponseDict.Name;

                if (name.indexOf("$%#") != -1) {
                    var names = name.split("$%#");
                    if (obj.val() == names[0]) {
                        $(this).attr("checked", "checked");
                        $("#" + other + "").val(names[1]);
                    }

                }
                else {
                    if (obj.val() == name)
                        $(this).attr("checked", "checked");
                }
            })
        }

        var unSatisfyType;

        function Unsatisfy(type) {
            $("#contractBox").hide();
            $("#contractUnlike").show();

            if (type == "View") {
                $("#contractUnlike input[type='radio']").each(function () {
                    $(this).attr("disabled", "disabled");
                })

                unSatisfyType = "viewReason";

                $("#txtUnlikeOthers").attr("readonly", "readonly");
                $("#h3UnReason").html("企业不满意原因");
                $("#contractUnlikeCancel").html("重新提交");

                $("#btnUnlick").hide();
                $("#contractUnlikeCancel").removeClass("cancel");

                common.commonAjax({ type: 'Get', url: '/api/project/GetContractData?id=' + param.id + "&name=RejectRemark", sMethod: AfterGetData });
            }
        }

        function AfterGetData(ctx) {
            $("#contractUnlike input[type='radio']").each(function () {
                var obj = $(this);

                var name = ctx.ResponseDict.Name;

                if (name.indexOf("$%#") != -1) {
                    var names = name.split("$%#");
                    if (obj.val() == names[0]) {
                        $(this).attr("checked", "checked");
                        $("#txtUnlikeOthers").val(names[1]);
                    }

                }
                else {
                    if (obj.val() == name)
                        $(this).attr("checked", "checked");
                }
            })
        }

        var editor = common.CreateEditor('ActivitySummary');

        $(".contract-pBar-feedback").on('click', function () {
            $(".mask,#contractBox").show();
        });
        $(".contract-detailBtn a").on('click', function () {
            $(".mask,#contractDetailBox").show();
        });
        $(".contract-cancel,.disblock").on('click', function () {
            $(".mask,#contractBox-cancel").show();
        });
        //$("#unsatisfy").on('click', function () {
        //    $("#contractBox").hide();
        //    $("#contractUnlike").show();
        //});
        $(".contractBox-title-close,#contractUnlikeCancel").on('click', function () {
            $(".mask,#contractBox,#contractDetailBox,#contractBox-cancel,#contractUnlike").hide();

            if ($(this).attr("id") == 'contractUnlikeCancel' && unSatisfyType == "viewReason")
                $(".mask,#contractBox").show();
        });
    </script>
</body>
</html>
